#define PC

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;

#if PC
using System.Diagnostics;
#endif


namespace TimeWar.Objects
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Universe : ActiveGameObject
    {

        protected Game gameObj;
        protected SpriteBatch spriteBatch;
        protected int objState;
        private GameCursor mapCursor;


        public Universe(Game game, int selectedSide)
            : base(game)
        {
            // TODO: Construct any child components here
            gameObj = game;

            mapCursor = new GameCursor(game, selectedSide);


            Planet gallifrey = new Planet(game);
            gallifrey.setName("Gallifrey");
            gallifrey.setPrimaryGraphicLocation("Planets\\gallifreyMapView");
            gallifrey.setCursorOverContentLocation("Planets\\gallifreyMouseOver");
            gallifrey.setCurrLocation(25, 25);
            gallifrey.LoadContent(game.GraphicsDevice);
            gallifrey.setGameCursor(mapCursor);
            childGameObjects = new System.Collections.ArrayList();
            childGameObjects.Add(gallifrey);
            setGameCursor(mapCursor);



        }




        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }


        public override void Draw(GraphicsDeviceManager graphics, GameTime gameTime, SpriteBatch gameSpriteBatch)
        {
#if PC
            Trace.WriteLine("[" + DateTime.Now + "]: Calling Universe.Draw().");
#endif


            graphics.GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin();

            if (childGameObjects != null && childGameObjects.Count > 0)
            {

                foreach (ActiveGameObject obj in childGameObjects)
                {
                    obj.Draw(graphics, gameTime, spriteBatch);
                }
            }

            mapCursor.Draw(graphics, gameTime, spriteBatch);

            spriteBatch.End();

        }

        public override void LoadContent(GraphicsDevice graphicsDevice)
        {
#if PC
            Trace.WriteLine("[" + DateTime.Now + "]: Calling Universe.Draw().");
#endif

            spriteBatch = new SpriteBatch(graphicsDevice);

            mapCursor.LoadContent();



        }

    }

}